home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / eflibpt4.zip / DEMO / DATATYPE / LINKASRT.PAS < prev    next >
Pascal/Delphi Source File  |  1996-08-18  |  1KB  |  35 lines

  1. { Borland Pascal Extended Function Library - EFLIB (C) Johan Larsson, 1996
  2.   Demonstration; linked lists with active sorting
  3.  
  4.   EFLIB IS PROTECTED BY THE COPYRIGHT LAW AND MAY NOT BE COPIED, SOLD OR
  5.   MANIPULATED. FOR MORE INFORMATION, SEE PROGRAM MANUAL! THIS DEMONSTRAT-
  6.   ION PROGRAM MAY FREELY BE USED AND DISTRIBUTED.                          }
  7.  
  8.  
  9. uses EFLIBDEF, EFLIBINI, EFLIBBAS, EFLIBDAT;
  10.  
  11.  
  12. var MyText : TextObjectType; Index : word;
  13.  
  14. begin
  15.      with MyText do begin
  16.           { Initialize a structure based on text strings }
  17.           Initialize;
  18.  
  19.           { Enable active sorting with ascending sort order }
  20.           SetAscendingOrder;
  21.           SetSearchMethod (BinarySearchMethod);
  22.  
  23.           { Add something to the structure }
  24.           AddText ('Kenneth'); AddText ('Adam'); AddText ('Jenny');
  25.           AddText ('Clark'); AddText ('Jonathan'); AddText ('Eve');
  26.           AddText ('Lucas');
  27.  
  28.           for Index := 1 to Elements do WriteLn (Text(Index));
  29.  
  30.           if IsSorted(AscendingOrder) then WriteLn ('Structure is SORTED!')
  31.              else WriteLn ('Structure is NOT SORTED!');
  32.           Intercept;
  33.      end;
  34.      if GlobalDataError then WriteLn ('Error(s) reported!');
  35. end.